import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '登录',
    component: () => import('../views/LoginView'),
  },
  {
    path: '/home',
    component: () => import(/* webpackChunkName: "about" */ '../views/ManageView.vue'),
    redirect: "/home/homepage",
    children:[
      {path: 'backup',name: '数据库备份还原', component: () => import('../views/BackUp.vue')},
      {path: 'homepage',name: '首页', component: () => import('../views/HomeView')},
      {path: 'charts',name: '统计分析', component: () => import('../views/StatisticsView.vue')},
      {path: 'case',name: '我的案件', component: () => import('../views/CaseView.vue')},
      {path: 'collection',name: '案件收藏', component: () => import('../views/CollectionView.vue')},
      {path: 'status',name: '审核状态', component: () => import('../views/CaseStatusView.vue')},
      {path: 'submit',name: '提交审核', component: () => import('../views/SubmitView.vue')},
	  {path: 'ccode',name: '法律字典', component: () => import('../views/CCodeView.vue')},
      {path: 'dealt',name: '待办事项', component: () => import('../views/dealt/DealtView.vue'),
            children:[
              {path: '/',name:'department',component: () => import('../views/dealt/UnDealt.vue')},
              {path: 'dealing',name:'department',component: () => import('../views/dealt/DealtingView.vue')},
              {path: 'dealted',name:'department',component: () => import('../views/dealt/DealtedView.vue')},
            ]},
      {path: 'user',name: '用户管理', component: () => import('../views/UserView')},
      {path: 'gmuser',name: '用户管理', component: () => import('../views/GMCuserView.vue')},
      {path: 'workmanager',name: '工作流管理', component: () => import('../views/WorkManager.vue')},
      {path: 'courtMag',name: '法院机构管理',component: () => import('../views/CourtView.vue'),
       children: [ {path: '/',name:'department',component: () => import('../views/courtSon/departmentView.vue')},
                  {path: 'role',name: '角色管理',component: () => import('../views/courtSon/RolesView.vue')},
                  {path: 'post',name: '岗位管理',component: () => import('../views/courtSon/PostView.vue')},
                  {path: 'user',name: '用户管理',component: () => import('../views/courtSon/UserView.vue')}]}
      // {path: 'file',name: '文件管理', component: () => import('../views/FileView')}
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

router.afterEach((to, from) => {
  document.title = to.name
})
export default router
